<!-- Generated automatically from an XML file of the same name.
     Copyright: Stephen J. Sangwine and Nicolas Le Bihan, 2008-2010.
--><html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <title>inv :: Functions (Quaternion Toolbox Function Reference)
</title><link rel="stylesheet" href="qtfmstyle.css" type="text/css"></head><body><h1>Quaternion Function Reference</h1><h2>inv</h2>
<p>Inverse of quaternion matrix<br>(Quaternion overloading of standard MATLAB&reg; function)
</p>
<h2>Syntax</h2><p><tt>Y = inv(X)</tt></p>
<h2>Description</h2>
<p>
Given a single quaternion, <tt>inv(X)</tt> computes the inverse, that
is the conjugate divided by the modulus. The inverse exists for all real
quaternions, but not for all complexified quaternions. An error will result
in cases where a complexified quaternion has no inverse.
</p>
<p>
Given a <i>square</i> quaternion matrix, <tt>inv(X)</tt>
computes a matrix inverse using an analytical formula based on partitioning
the matrix into sub-matrices. This formula is inevitably inaccurate for
larger matrices and a better method may be substituted in the future.
</p>
<p>
No warning is given if the matrix is singular - the result will be NaNs.
</p>

<h2>Examples</h2>
<pre>
&gt;&gt; inv(qi + qj + qk)
 
ans = -0.3333 * I - 0.3333 * J - 0.3333 * K
 
&gt;&gt; ans * (qi + qj + qk)
 
ans = 1 + 0 * I + 0 * J + 0 * K
 
&gt;&gt; q = randq(3)
 
q = 3x3 quaternion array
 
&gt;&gt; show(q * inv(q))
 
S =
 
    1.0000    0.0000         0
    0.0000    1.0000   -0.0000
    0.0000   -0.0000    1.0000

X =
 
   1.0e-15 *

         0   -0.0139    0.0278
         0   -0.0833   -0.1665
   -0.0555    0.1249    0.1665

Y =
 
   1.0e-15 *

   -0.0278   -0.0555    0.0555
   -0.1665    0.0555    0.2220
    0.1110   -0.0555   -0.1110

Z =
 
   1.0e-15 *

         0   -0.0278    0.0035
    0.1110    0.0139    0.0555
    0.0555    0.0416         0
</pre>

<h2>See Also</h2>MATLAB&reg; function: <a href="matlab:doc inv">inv</a><br>
<h2>References</h2><ol><li>R. A. Horn and C. R. Johnson, <i>Matrix Analysis</i>,
Cambridge University Press, 1985, &sect;0.7.3, page 18.
</li></ol>
<h4>&copy; 2008-2010 Stephen J. Sangwine and Nicolas Le Bihan</h4><p><a href="license.html">License terms.</a></p></body></html>